package com.synergy.stockflow.warehouse.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.synergy.stockflow.product.entity.Material;
import io.swagger.v3.oas.annotations.media.Schema;
import java.math.BigDecimal;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Schema
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "inventory_transaction")
public class InventoryTransaction {
    /**
     * 交易流水ID
     */
    @TableId(value = "transaction_id", type = IdType.ASSIGN_ID)
    @Schema(description="交易流水ID")
    private String transactionId;

    /**
     * 交易类型(PO_IN, MO_OUT, SO_OUT, ADJ_IN, ADJ_OUT, TRANSFER_IN, TRANSFER_OUT)
     */
    @TableField(value = "transaction_type")
    @Schema(description="交易类型(PO_IN, MO_OUT, SO_OUT, ADJ_IN, ADJ_OUT, TRANSFER_IN, TRANSFER_OUT)")
    private String transactionType;

    /**
     * 源单据ID(如采购单号、生产计划号)
     */
    @TableField(value = "source_doc_id")
    @Schema(description="源单据ID(如采购单号、生产计划号)")
    private String sourceDocId;

    /**
     * 源单据类型(purchase_order, production_plan, shipment_history)
     */
    @TableField(value = "source_doc_type")
    @Schema(description="源单据类型(purchase_order, production_plan, shipment_history)")
    private String sourceDocType;

    /**
     * 仓库ID
     */
    @TableField(value = "warehouse_id")
    @Schema(description="仓库ID")
    private String warehouseId;

    /**
     * 物料ID
     */
    @TableField(value = "material_id")
    @Schema(description="物料ID")
    private String materialId;

    /**
     * 批次号
     */
    @TableField(value = "batch_no")
    @Schema(description="批次号")
    private String batchNo;

    /**
     * 交易数量(出库为负, 入库为正)
     */
    @TableField(value = "quantity")
    @Schema(description="交易数量(出库为负, 入库为正)") 
    private BigDecimal quantity;

    /**
     * 交易时间
     */
    @TableField(value = "transaction_time")
    @Schema(description="交易时间")
    private Date transactionTime;

    /**
     * 操作员ID
     */
    @TableField(value = "operator_id")
    @Schema(description="操作员ID")
    private String operatorId;

    /**
     * 备注
     */
    @TableField(value = "remarks")
    @Schema(description="备注")
    private String remarks;

    @TableField(exist = false)
    @Schema(description="备注")
    private Material material;

    @TableField(exist = false)
    @Schema(description="备注")
    private Warehouse warehouse;
}